home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Arsenal Files 4
/
The Arsenal Files 4 (Arsenal Computer).ISO
/
gen_prog
/
inst103.exe
/
INSTALL.DOC
< prev
next >
Wrap
Text File
|
1995-01-03
|
39KB
|
1,562 lines
┌──── ┌─── ┌── ┌────── ┌──────── ┌────── ┌── ┌── ┌────── ┌───────
┌── ┌──┌─ ┌── ┌── ┌── ┌── ┌── ┌── ┌── ┌── ┌── ┌──
┌── ┌── ┌─┌── ┌────── ┌── ┌──────── ┌── ┌── ┌──── ┌───────
┌── ┌── ┌─── ┌── ┌── ┌── ┌── ┌── ┌── ┌── ┌── ┌──
┌──── ┌── ┌── ┌────── ┌── ┌── ┌── ┌────── ┌────── ┌────── ┌── ┌──
──────────────────────────────────────────────────────────────────────
Installer! v1.03
(c) Copyright 1994 by Matthew Mastracci
Every single last (all) right(s) reserved
──────────────────────────────────────────────────────────────────────
in'stall - to set in position for use
──────────────
Table of contents
──────────────
Topics are just as they appear here in the contents, so you can use a
search with greater ease.
0.0 Just a few legal issues
1.0 Introduction
1.1 NB!
1.2 Revisions
2.0 Usage (from writing to compiling)
2.1 Deciding on features
2.2 Editing the script
2.3 Running the script
2.4 CHECKing the script
2.5 COMPILEing the script
2.6 Command-line usage
3.0 Script-land
3.1 Constants
3.2 Variables
3.3 Commands
3.4 Labels
3.5 Put it all together...
3.6 ...and whatd'ya got?
4.0 Special Variables
5.0 Command Reference
6.0 Error Codes
7.0 CHECK: Script Syntax Checker
7.1 Errors and warnings for CHECK and COMPILE
8.0 COMPILE: Script Compiler
9.0 Demos
10.0 Keeping in touch
──────────────
0.0 Just a few legal issues
──────────────
To start out, I'd like to say that I'm going to have as *few* legalities
for this program as possible (ha!). The best way to put them would be in a
list, so here goes:
1. This (the unregistered version of Installer!) may be used in any freeware
or shareware demo program without permission. It may not be used in a
commercial product, as per point 2.
2. If the program is going to be used in a commercial package, contact with
the author is necessary first. A small fee (small!) will be charged, in
which you recieve a license to use the program in a commercial environment,
and also a version which has a customized title screen.
3. Anyone can purchase a license and a blank title screen version by
contacting the author. This version can still only by used in a
shareware environment, but looks much nicer.
4. Any damages caused by this program are purely coincidential. I am not
responsable for anything which happens to your or anyone else's computer
while using this program. Please don't take this as an expectation of
something going wrong, just a warning that if something does, it's not
my fault.
5. This isn't really a legality, but I'd just like to ask you to put a little
word or two in your docs, just so I can see where this program gets to...
;)
──────────────
1.0 Introduction
──────────────
The one thing that nearly all shareware and commercial packages have is
an install program. Quality of these installation programs can vary from
absolute crap to a stunningly beautiful piece of art. Sadly, this facet of
program development is sometimes neglected. Hurried authors compose quick-
and-dirty batch files to copy the files and maybe a small CON I/O install
program to set up one or two options. This is why the need for a programming
script based installation program is so great. With one, you could create a
fully functional script to copy files, set up configurations and still have
colorful, user-friendly interfaces. That's the reason for Installer.
1.1 NB!
Here's a message that came through comp.lang.pascal on November 26th, 1994,
two days after I did the manual:
├──── 8< ──────────
PROBLEM WITH UNAUTHORIZED WINDOWS 95 DISK SETUP
-----------------------------------------------
If you have the disk that accompanies my new book, "Unauthorized Windows 95," a
word of warning before you try to install the disk: the lame batch file setup
(I had all of six hours to put the disk together, so there's not even a proper
Windows setup) has a really stupid bug:
set uwdest=C:\UNAUTHW
...
set uwdest=%1
...
md %uwdest%
cd %uwdest%
...
Wishful thinking on my part that the CD command would switch drives as well as
directories! If you run this from any drive other than the destination drive,
the CD command will fail. And if run directly from the floppy drive (for
example, by clicking on SETUP.BAT in File Manager or in the Win95 Explorer),
the results are disasterous, because of the following commands later on in the
setup:
del include.zip
del source.zip
del lib.zip
...
This ends up deleting the .zip files from the original floppy! (Unfortunately,
the manufacturer did not send the disk out write-disabled.)
The solution is to run the setup file from the same drive on which you wish to
install the Unauthorized software.
Sorry,
Andrew
├───── >8 ─────────
1.2 Revisions
1.0 - First beta release
.01 - Added STOP command
- Realized that FOPEN, FWRITE, FREAD and FCLOSE weren't in the manual
- Wrote the CHECK program for debugging scripts
.02 - Wrote the COMPILE program for converting scripts into an unreadable
binary form
.03 - Updated INSTALL.DOC with some help on the script-writing process
- Added the GOSUB, RETURN and COUNT commands
- Revised COPY.CFG to give a little help with GOSUB.
- Added the PCTBAR.CFG demo, and then converted it into a built-in
function.
- Fixed a stupid CLREOL bug.
- And (ba-da-bing) first non-beta release!
──────────────
2.0 Usage (from writing to compiling)
──────────────
Installer! is an easy program to use in the development of custom
installation scripts. There are five basic steps to creating and shipping
an Installer! script with your program:
1. Decide which features you want in your program
2. Using EDIT or another ASCII word-processor, edit your script (taking bits
from the demos, if necessary)
3. Run the program and check for flaws, if there are problems, redo step 2
4. Run CHECK on the program to look for any typos or mistakes, if there are
errors or warnings, redo step 2
5. Run COMPILE on the program and rename the compiled data file as
INSTALL.DAT, so it will be run automatically when the user types INSTALL
2.1 Deciding on features
Before you create your installation script, you must decide first what
you want in it. These bits can range from automatic copying to sound source
selection. From this, you can decide which demos to cannibolize, which to
rewrite to suit your taste and which to write from scratch. The demos are
explained in a little more depth in 9.0.
2.2 Editing the script
Once you've obtained your ideal form for an installation program, you can
now start to write it. The best way is to load up EDIT and begin from the
basics, saving and running each time you finish or debug a section.
2.3 Running the script
To run a script (either binary or text), just place the name of the file
you wish to run as the first parameter of INSTALL.EXE. The script-name
defaults to INSTALL.DAT and then INSTALL.CFG if it doesn't exist, so you can
automatically a script named INSTALL.CFG (if there is no INSTALL.DAT).
2.4 CHECKing the script
Once you've run all the bugs out of the program, you can run the CHECK
program on it. The CHECK program will scan through the lines of the program,
making sure all of the GOTOs have matching labels, the quotation marks are
matched up, etc. To run it, just type CHECK and then the text script-name
as the first parameter. The errors for this program are explained in-depth
in section 6.0.
2.5 COMPILEing the script
Now that all the grammatical errors are out of the script, you want to
compile it into an unreadable binary form. To do this, just run the COMPILE
program with the text script-name as the first parameter and make sure there
are no errors. Once this is done, rename the compiled .DAT file as
INSTALL.DAT, so the user can run INSTALL.EXE and have the script run. For
more information, see section 8.0.
2.6 Command-line usage
Usage: install [scriptname .cfg | .dat]
"scriptname" can be a .cfg or .dat file. If none is specified, it
reads install.dat (or install.cfg if it doesn't exist).
──────────────
3.0 Script-land
──────────────
3.1 Symbols
The script language for Installer is created for its absolute ease of
use. Cryptic symbols and punctuational vertigo have been done away with and
replaced with easy to use commands with easy to remember syntaxes. Variables
have been encompassed down into two simple types: integer and string. Integer
variables contain numbers that can range from -2,147,483,648 to 2,147,483,647,
which just so happens to be the amount that a 32-bit variable can hold. Text
is held in variables called Strings, which are basically strings of letters
that can anywhere be from 0 to 255 characters long. Variables are identified
by two symbols (two of the only three in the script language), the pound sign,
representing integers (#) and the dollar sign, representing strings ($). Here
is a simple little demo of variables:
#cows - Integer variable
$hisname - String variable
#hisage - Integer variable
$address - String variable
3.2 Variables
The adjective "variable" describes something which can change. Not all
things _can_ change however. Take the number 3 for example. If you change
it to a 4, it's no longer a 3. That's why constants are required. To be
constant means to stay the same (like 3). Integer constants are easy: all
they consist of is a number, maybe with a negative sign in front. String
constants are a little tougher: they are text encompassed by the quote (")
characters. Here are a few examples of constants:
123 - Integer constant
"123" - String constant
-2000000 - Integer constant
"Catch-22" - String constant
NB: if you're wondering how to put a quote (") inside a string constant,
read the reference on the string variable $quote...
3.3 Commands
Using a mix of variables and constants, the program can be instructed to
do a multitude of activities by giving it commands. To command something is
to tell it what to do (or else), which quite aptly describes the use of the
commands in the script language. A command is comprised to two simple parts:
the name and the parameters (sometimes referred to as arguments, but that
doesn't go over well with most people). The name of the command is analogous
to a telephone number. You can't exactly expect a positive result from Bob if you
call up the local Pizza Hut and say "file the '94 budget!" (in most cases Bob
doesn't even know he has to do anything). The parameters of the command are
also quite ingeniously named. If you give someone orders which contain some
"mission parameters," you are telling them what they can or cannot do. Ditto
for a command's parameters (quite ditto, to say the least). To preserve the
element of balance in this document, here are some command/parameter examples:
clrscr
^ C
write "His name is " $name " and he lives at " #housenum $address
^ C ^ SC ^ SV ^ SC ^ IV ^ SV
comma 153464 $bignum
^ C ^ IC ^ SV
NB: String and Integer variables and constants are abbreviated to SV, SC,
IV and IC; while commands are abbreviated to C. Sorry for the
cryptics, but I ran out of room... <grin>
3.4 Labels
To create even a partially structured language, labels are required. In
Installer!, the way to define a label is to precede it with a colon (:). When
referring to the label in a goto or if statement, don't use a colon. Here's
a little example:
writeln "Here! (1)"
goto Past
writeln "Shouldn't be here! (2)"
; never gets seen
:Past
writeln "Here! (3)"
3.5 Put it all together...
Probably the most used command of all is the "put" command. It transfers
the value of a string of integer variable or constant into a string or integer
variable, converting between the two if necessary. It looks something like
this:
Command Variable Values
put $salestext into #sales $salestext = "-100" #sales = -100
^ C ^ SV ^ IV
put 4 into $four $four = "4"
^C ^IC ^ SV
NB: the "into" part of the command is mainly for flow, and is not required
to be the word "into." It could be "spam" for all the program cares...
3.6 ...and whatd'ya got?
Now that we have a good grasp of the language, let's put together a tiny
script to get used to the language:
-- 8< -- cut
; Tiny little script demo
write "Enter a number: "
; Writes the string "Enter a number: " to the screen, leaving the cursor at
; the end
read #n
; Reads a string from the user, converts it to an integer and stores it in the
; integer variable "#n"
mul #n 5
; Multiples the value in #n by 5 and then puts the new value back
writeln "Your number multiplied by 5 is " #n
; Tells the user what their number is when it's multiplied by 5
-- 8< -- cut
NB(s): The lines that start with a semicolon (;) are comments. To run this
script, cut between the little cut marks and paste (editor, not
Elmer's) it into a file named INSTALL.CFG. To run it, just type
"INSTALL" at the DOS prompt and Installer will run it for you.
──────────────
4.0 Special Variables
──────────────
These variables have special meaning in the program. They can be
accessed and modified like regular variables, but contain information that
controls the flow of the program:
──────────────
#FATTR
──────────────
Holds the file attribute from the file found using the last "findnext"
command. The bits of the value are used as follows:
7 6 5 4 3 2 1 0 (2 ^ x or 1 shl x)
o o o o o o o o
│ │ │ │ │ │ │ Read Only
│ │ │ │ │ │ Hidden
│ │ │ │ │ System
│ │ │ │ Volume Label
│ │ │ Directory
│ │ Archive
│ Unused
Unused
Example:
; print directory name
put "." into $curdir
fexpand $curdir
writeln "Directory of " $curdir
writeln
find "*.*" 63
; find all files
:Read
findnext
; load $fname and #fattr
write $fname " "
gotoxy 15 #wherey
put #fattr into #attr
and #attr 1
; test for read only attribute
if #attr = 0 then Hidden
write "R/O "
:Hidden
put #fattr into #attr
and #attr 2
; test for hidden attribute
if #attr = 0 then System
write "Hid "
:System
put #fattr into #attr
and #attr 4
if #attr = 0 then Archive
; test for system attribute
write "Sys "
:Archive
put #fattr into #attr
and #attr 32
if #attr = 0 then Next
; test for archive attribute
write "Arc "
:Next
writeln
if #filesleft = 1 then Read
──────────────
#FILESLEFT
──────────────
Reports 1 if there are any more files to be retrieved with findnext or
else 0 if there aren't.
find "\autoexec.bat" 63
findnext
if #filesleft = 1 then Fine
writeln "AUTOEXEC.BAT not found!"
:Fine
──────────────
$FNAME
──────────────
Holds the filename from the last findnext command.
find "\*.bat" 63
findnext
writeln "First batch file in root directory is " $fname
──────────────
#FSIZE
──────────────
Holds the size for the last file found using the findnext command and
the total size of all files found with the count command.
Example:
find "*.*" 32
; find all archive files
:Read
findnext
add #total #fsize
if #filesleft = 1 then Read
comma #total $total
writeln "Total: " $total " bytes"
(see COPY.CFG for an example using count)
──────────────
#LASTRESULT
──────────────
Holds the last result of an arithmatic command. The arithmatic commands
are: add, and, dec, div, inc, mod, mul, or, sub and xor.
Example:
put 15 into #sales
add #sales 25
; 40
put 32 into #sales
writeln "#sales was " #lastresult " before and " #sales " now."
──────────────
#PERCENT
──────────────
Holds the percentage calculated by a pctbar statement.
(see COPY.CFG for an example)
──────────────
#TEXTCOLOR
──────────────
Holds the color used for writing text on the screen with writeln, write
and all other string-writing commands. The bit layout for this is:
7 6 5 4 3 2 1 0 (2 ^ x or 1 shl x)
o o o o o o o o
│ │ │ │ │ │ │ │
│ │ │ │ Foreground color
│ Background color
Blink
Color = fore + (back * 16) + (blink * 128)
Example:
; clear screen to bright write on blue
put 31 into #textcolor
clrscr
; write text in yellow and red
put 78 into #textcolor
clreol
center 1 "Yellow on red!"
──────────────
$QUOTE
──────────────
Holds the quote character (").
Example:
writeln "He said, " $quote "Hi there!" $quote
──────────────
#READUPDOWN
──────────────
Instructs the readfield command, if there is a number present in the
entry area, to increment or decrement it by one when the user presses the up
or down keys.
Example:
put 10 into $s
put 1 into #readupdown
writeln "Use the up and down arrow keys to adjust the number."
readfield 1 2 10 $s
──────────────
#WHEREX
──────────────
Holds the current cursor X position on the screen.
Example:
random 60 #x
random 24 #y
gotoxy #x #y
put #wherex into #l1
put #wherey into #l2
writeln "(" #l1 ", " #l2 ")"
──────────────
#WHEREY
──────────────
Holds the current cursor Y position on the screen.
find "*.*" 63
findnext
write $fname
gotoxy 15 #wherey
write #fsize
──────────────
5.0 Command Reference
──────────────
The parameters for the commands are designated as follows:
#var - Integer variable
$var - String variable
[#var] - Variable is optional
#var1 | #var2 - Either variable may be used
──────────────
ADD
──────────────
Syntax: add #var #val
Adds "#val" to the current value of "#var", placing the result in "#var".
Example:
put 10 into #n
add #n 20
writeln "10 + 20 = " #n
──────────────
AND
──────────────
Syntax: and #var #val
Binary ands the value of "#var" with "#val", placing the result in "#var".
1 and 1 = 1
1 and 0 = 0
0 and 1 = 0
0 and 0 = 0
(see #fattr for example)
──────────────
BUILD
──────────────
Syntax: build
Copies the current screen to a temporary page and changes the display
page to view that page. All screen writes take place on the hidden page while
in this mode. Use show to restore the changes.
Example:
build
rwrite 40 "│ │ "
show
──────────────
CENTER
──────────────
Syntax: center #y $text
Centers the text "$text" on row "#y".
(see #textcolor for example)
──────────────
CHDIR
──────────────
Syntax: chdir $dir
Changes the current drive and directory to "$dir".
Example:
write "Which directory to change to? "
read $s
chdir $s
──────────────
CLOSEWIN
──────────────
Syntax: closewin
Closes the last opened window on the screen.
window 3 3 20 20 79 79 79 "Window!" 1
wait 2
closewin
──────────────
CLREOL
──────────────
Syntax: clreol
Clears to the end of the current line, using the color in textcolor.
(see #textcolor for example)
──────────────
CLRSCR
──────────────
Syntax: clrscr
Clears the screen or text window to the color in textcolor.
(see #textcolor for example)
──────────────
COMMA
──────────────
Syntax: comma #num $comma'd
Adds commas to the value in "#num", storing the result as a string in
"$comma'd"
(see #fsize for example)
──────────────
COUNT
──────────────
Syntax: count $filespec #attr #total
Counts the number of files matching "$filespec" and "#attr" and stores
the total number in "#total". Stores the total size in "#fsize". This
should not be used concurrently with find and findnext.
(see COPY.CFG for example)
──────────────
DEC
──────────────
Syntax: dec #var
Decrements "#var" by 1.
Example:
put 78 into #n
dec #n
writeln "78 - 1 = " #n
──────────────
DISKFREE
──────────────
Syntax: diskfree $drive #free
Stores the amount of space free on "$drive" in "#free". To get the free
space on the current drive, use "" for "$drive".
Example:
diskfree "" #n
div #n 1024
comma #n $free
writeln $free " bytes free on current drive"
──────────────
DIV
──────────────
Syntax: div #var #val
Divides #var by #val, storing the result in #var.
(see diskfree for example)
──────────────
FCOPY
──────────────
Syntax: fcopy $source $dest
Copies the file from "$source" to "$dest".
Example:
fcopy "\autoexec.bat" "\autoexec.bak"
──────────────
FEXPAND
──────────────
Syntax: fexpand $filename
Expands "$filename" into a fully qualified pathname, including drive,
directory and file (if any).
put "." into $curdir
fexpand $curdir
writeln "Current directory is " $curdir
──────────────
FIND
──────────────
Syntax: find $filespec #attr
Sets up the parameters for the findnext command. The findnext command
returns a list of files (one by one) that match the wildcards in "$filespec"
and only have attributes that are specified in "#attr".
7 6 5 4 3 2 1 0 (2 ^ x or 1 shl x)
o o o o o o o o
│ │ │ │ │ │ │ Read Only
│ │ │ │ │ │ Hidden
│ │ │ │ │ System
│ │ │ │ Volume Label
│ │ │ Directory
│ │ Archive
│ Unused
Unused
With this list of files, only the ones marked with a * will be returned with
the command: find "*.sys" 35
AUTOEXEC.BAT Arc R/O <- doesn't match wildcard
*CONFIG.SYS Arc R/O <- matches
IO.SYS Arc R/O Hid Sys <- has sys attribute, not specified
MSDOS.SYS Arc R/O Hid Sys <- has sys attribute, not specified
IMAGE.IDX Arc R/O Hid <- doesn't match wildvard
(see #fattr for example)
──────────────
FCLOSE
──────────────
Syntax: fclose
This closes the file opened with "fopen".
Example:
fopen "test.$$$" 1
fwrite "Hi!"
fwrite "12"
fclose
fopen "test.$$$" 0
fread $s
writeln $s
fread #i
writeln #i
──────────────
FOPEN
──────────────
Syntax: fopen $filename #mode
Opens the file "$filename" in write (#mode = 1) or read (#mode = 0).
(see fclose for example)
──────────────
FREAD
──────────────
Syntax: fread var
Reads a line of text from the file opened with fopen.
(see fclose for example)
──────────────
FWRITE
──────────────
Syntax: fwrite [var1 ... [var]]
Writes the list of variables to the file opened with fopen.
(see fclose for example)
──────────────
GOSUB
──────────────
Syntax: gosub label
Transfers execution of the program to the line labelled with "label" and
pushes the current line onto the gosub stack. Use RETURN to pop the
linenumber off the stack.
Example:
put 1 into #x
gosub Mul5
put 2 into #x
gosub Mul5
stop
:Mul5
mul #x 5
writeln #x
return
──────────────
GOTO
──────────────
Syntax: goto label
Transfers execution of the program to the line labelled with "label".
(see #fattr for example)
──────────────
GOTOXY
──────────────
Syntax: gotoxy #x #y
Moves the cursor to (#x, #y).
(see #wherex for example)
──────────────
IF ... THEN
──────────────
Syntax: if condition then label
If condition is true, then execution is transferred to the line labelled
"label". These are the possible conditions:
var1 = var2 the two variables are equal
var1 > var2 var1 is greater than var2
var1 < var2 var1 is less than var2
var1 <> var2 var1 is not equal to var2
NB: If var1 and var2 are not the same type then var2 is converted to var1's
type.
(see #fattr for example)
──────────────
INC
──────────────
Syntax: inc #var
Incrememnts the value of "#var" by one.
Example:
find "*.*" 63
:Read
findnext
inc #fn
writeln "#" #fn " " $fname
if #filesleft = 1 then Read
──────────────
LENGTH
──────────────
Syntax: length $str #len
Stores the length of string "$str" in "#len"
Example:
length "123456789" #n
writeln "Length is " #n
──────────────
MKDIR
──────────────
Syntax: mkdir $dir
Creates the directory "$dir". If there is more than one directory to
create, it will create them all one by one.
Example:
write "Make what directory? "
read $s
mkdir $s
──────────────
MOD
──────────────
Syntax: mod #var #val
Performs modulos arithmatic on "#var" and "#val" and stores the result in
"#var". The modulos of two numbers is equal to the remainer of dividing them.
100 div 3 = 33 (r1)
100 mod 3 = 1
Example:
put 100 into #n
mod #n 3
writeln "100 mod 3 = " #n
──────────────
MUL
──────────────
Syntax: mul #var #val
Multiplies the value of "#var" by "#val" and stores the result in "#var".
Example:
put 5 into #n
mul #n 3254
writeln "5 * 3254 = " #n
──────────────
OR
──────────────
Syntax: or #var #val
Bitwise or's the values of "#var" and "#val" and stores the result in
"#var".
1 or 1 = 1
1 or 0 = 1
0 or 1 = 1
0 or 0 = 0
Example:
put 54 into #n
or #n 128
writeln "54 or 128 = " #n
──────────────
PCTBAR
──────────────
Syntax: pctbar #x #y #len #sofar #tot
Draws a "percent done" bar at (#x, #y) with a length of "#len". "sofar"
represents how much of the total, "#tot", has been finished, ie: for 5 things
done out of 17, #sofar would be 5 and #tot would be 17. It returns the
calculated percentage in #percent. The bar is calculated like this:
#percent = #sofar * 100 div #tot <- the calculated percentage
#covered = #percent * #len div 100 <- the length of the covered portion
#uncovered := #len - #covered <- the length of the uncovered portion
(see COPY.CFG for an example)
──────────────
PUT
──────────────
Syntax: put val into var
Places the value "val" into the variable "var". It automatically adjusts
the type of the value to the type of variable, ie: it will convert a string to
an integer value to store it in an integer variable. "val" can be a variable
or a constant.
Example:
put "Text" into #IntVar
writeln #IntVar
; #"Text" = 0
put "99' into #IntVar
writeln #IntVar
; #"99" = 99
put 99 into #IntVar
writeln #IntVar
; #99 = 99
put "Text" into $StrVar
writeln $StrVar
; $"Text" = "Text"
put "99" into $StrVar
writeln $StrVar
; $"99" = "99"
put 99 into $StrVar
writeln $StrVar
; $99 = "99"
──────────────
RANDOM
──────────────
Syntax: random #val #var
Picks a number x, so that 0 <= x < "#val", and stores it in "#var".
(see #wherex for example)
──────────────
READ
──────────────
Syntax: read $s
Reads a line of text into the variable "$s", converting it if necessary.
Example:
write "Enter your name: "
read $s
write "Age? "
read #a
writeln
writeln "Data:"
writeln
writeln "Name: " $s
writeln "Age: " #a
──────────────
READFIELD
──────────────
Syntax: readfield #x #y #len $s
Reads a delimited field from the user at (#x, #y). Fills the entry box
with the value of "$s", and then pads the rest using spaces. It uses the
color in TextColor. Hitting ESC while editing brings back the default. When
the default is shown, pressing any character key will erase it.
Editing keys:
Left: Moves cursor left one space
Right: Moves cursor right one space
Home: Moves cursor to start
End: Moves cursor to end
Delete: Deletes character at cursor
Backspace: Removes character before cursor
Esc: Restores last input
(only if #READUPDOWN is not set to 0)
Up: Increases the value of the field by one if it is an integer
Down: Decreases the value of the field by one if it is an integer
Example:
clrscr
put 31 into #textcolor
clreol
center 1 "Demo Install Program"
gotoxy 1 25
clreol
center 25 "(c) 1994 by Matthew Mastracci"
put 7 into #textcolor
writechar 1 2 1840 "▒"
window 5 10 75 14 68 79 68 "" 1
gotoxy 7 12
put 79 into #textcolor
writeln "Enter something: "
put 63 into #textcolor
put " -- Default Response -- " into $s
readfield 24 12 50 $s
closewin
put 7 into #textcolor
clrscr
writeln "You typed: " $s
──────────────
READKEY
──────────────
Syntax: readkey $key
Reads a key from the key buffer if one is available, or else waits for
one. If the key is a regular one, it stores just the ascii value in the
variable "$key", else it stores a space in the first character and the
extended scan code in the second.
Example:
writeln "Hit a key..."
readkey $s
length $s #n
if #n = 1 then Regular
writeln "You hit an extended key"
goto Done
:Regular
writeln "You hit a regular key"
:Done
──────────────
RETURN
──────────────
Syntax: return
Pops the last linenumber off the gosub stack (effectively returning to
the line after the gosub).
(see gosub for example)
──────────────
RWRITE/RWRITELN
──────────────
Syntax: rwrite n [var1 ... [var]]
rwriteln n [var1 ... [var]]
Writes the list of variables to the screen "n" times. Useful for drawing
a background that has a multiple-char pattern instead of a single char. The
difference is that "rwriteln" put a carriage return after each listing.
Example:
clrscr
put 78 into #textcolor
rwrite 666 " "
write " "
; Finishes last bit of pattern
──────────────
SHOW
──────────────
Syntax: show
Swaps the display page back to the page that was building.
(see build for example)
──────────────
STRUPPER
──────────────
Syntax: strupper $s $upper
Converts the string "$s" to uppercase and stores it in "$upper".
write "Enter a string: "
read $s
strupper $s
writeln $s
──────────────
SUB
──────────────
Syntax: sub #var #val
Subtracts the value of "#val" from "#var", storing it in "#var".
put 15 into #n
sub #n 100
writeln "15 - 100 = " #n
──────────────
SUBSTR
──────────────
Syntax: substr $s #start #len $dest
Takes the substring of "$s", starting at "#start" and ending "#len"
characters later and stores it in $dest.
Example:
put "." into $curdir
fexpand $curdir
substr $curdir 1 1 $curdrive
writeln "Current drive is " $curdrive ":"
──────────────
STOP
──────────────
Syntax: stop #errorlevel
Halts the script, returning to DOS with an errorlevel of "#errorlevel".
The errorlevel can be tested using the "if ... then" batch command in DOS.
Example:
write "Errorlevel? "
read #err
halt #err
──────────────
STRPOS
──────────────
Syntax: strpos $substr $s #pos
Locates "$substr" in "$s" and places its location in "#pos". If it isn't
found, 0 is returned.
Example:
put "ABCDEFGHIJKLMNOPQRSTUVWXYZ" into $alphabet
write "Enter a letter: "
read $s
strupper $s $s
strpos $s $alphabet #num
writeln "Letter " $s " is at position " #num " in the alphabet"
──────────────
TEXTWIN
──────────────
Syntax: textwin [#x1 #y1 #x2 #y2]
Defines a window for text on the screen. To reset the coordinates, don't
pass any values.
Example:
put 31 into #textcolor
textwin 5 5 9 10
clrscr
writeln "hi hi hi hi hi hi hi hi"
put 7 into #textcolor
textwin
put 79 into #textcolor
gotoxy 35 15
writeln "Outside"
──────────────
WAIT
──────────────
Syntax: wait #secs
Waits "#secs" seconds and then returns.
(see closewin for example)
──────────────
WINDOW
──────────────
Syntax: window #x1 #y1 #x2 #y2 #c1 #c2 #c3 [$title [#type]]
Opens a window from (x1, y1) - (x2, y2) with the border color of "c1",
the inside color of "c2" and the title color of "c3". The title of the window
is optional. If the title is blank, the window will have no title. The type
can either be 0, which explodes the window on to the screen, or 1, which
expands the window horizontally and then vertically. To specify the type and
no window title, put "" as the title, or else the title will be your window
type. Use closewin to close the last window opened.
Example:
window 5 5 50 10 31 31 31 "Demo Window" 1
textwin 7 6 48 9
put 31 into #textcolor
writeln "window text"
wait 5
closewin
textwin
gotoxy 10 10
put 7 into #textcolor
writeln "Non-window text"
──────────────
WRITE/WRITELN/WRITETO
──────────────
Syntax: write [var1 ... [var]]
writeln [var1 ... [var]]
writeto var [var1 ... [var]]
write/writeLn:
Displays the variables/immediate values passed to it. Writeln goes the
beginning of the next line after printing the values.
writeto:
Takes the output from the write and stores it in the variable passed
to it. Used for concatinating strings and constructing displays.
Example:
put "456" into $s
put 789 into #n
writeln "123" $s #n " <- normal"
; Prints "123456789"
write #n $s "123" " <- reversed"
; Prints "789456123"
writeto $number $s "123" #n
writeln $number
; Prints 456123789
──────────────
WRITECHAR
──────────────
Syntax: writechar #x #y #n $character
Writes "#n" times, the first character of the string "$character" at
(#x, #y) in the current text color. Useful for flashing single character
backgrounds onto the screen.
Example:
clrscr
put 31 into #textcolor
clreol
center 1 "Demo Install Program"
gotoxy 1 25
clreol
center 25 "(c) 1994 by Matthew Mastracci"
put 7 into #textcolor
writechar 1 2 1840 "▒"
──────────────
XOR
──────────────
Syntax: xor #var #val
Bitwise xor's the values of "#var" and "#val" and stores then in "#var".
put 128 into #n
xor #n 255
writeln "128 xor 255 = " #n
──────────────
6.0 Error Codes
──────────────
These are the runtime errors that can occur in the program. If any
code pops up that isn't on this list, please contact me ASAP.
Code Error
File errors:
2 File not found
3 Path not found
4 Too many open files (increase files= in config.sys)
5 File access denied
15 Invalid drive number
16 Cannot remove current directory
Disk faults:
150 Disk is write-protected
152 Drive not ready
154 CRC error in data
156 Disk seek error
157 Unknown media type
158 Sector Not Found
159 Printer out of paper
160 Device write fault
161 Device read fault
162 Hardware failure
Other:
200 Division by zero
201 Range check error
202 Out of memory
203 " " "
──────────────
7.0 CHECK: Script Syntax Checker
──────────────
The CHECK program is included with the package to make script debugging
much easier. It analyzes the script and generates a list of errors and
warnings (preceeded by either an E- or a W-) to help you isolate problems in
your scripts.
Usage: CHECK scriptname [> reportfile]
6.1 Errors and warnings for CHECK and COMPILE
Here are the errors and warnings you can recieve from the CHECK and
COMPILE programs:
Errors: (E-)
Integer variable expected:
- Means that you are trying to put an integer result into a constant.
Invalid test:
- The boolean test in an if ... then statement is not one of the allowed
ones.
Label not found:
- The label used in an if ... then or goto statement couldn't be found. Try
checking that the label is in the format of ":label".
Mismatched quotes
- This usually means that a quotation mark is missing from a string somewhere
in the line.
String variable expected:
- Means that you are trying to put a string result into a constant.
Unexpected end of line
- Usually means that some non-optional parameters are missing from the end of
the line.
Unknown command:
- The command is invalid or misspelt. Check the reference section for the
correct spelling or command.
Variable expected:
- Means that you are trying to "put" a value into a constant.
Value expected:
- Most likely that a # or $ is missing from the start of a variable.
Warnings: (W-)
"INTO" expected
- Usually means that "INTO" is either misspelt or missing from a put
statement. If your script doesn't work properly, check the line.
"THEN" expected
- Usually means that "THEN" is either misspelt or missing from an if ... then
statement. If your script doesn't work properly, check the line.
──────────────
8.0 COMPILE: Script Compiler
──────────────
The COMPILE program is included with the package to convert your text
scripts to a binary form when you want to complete your installation package.
It will take the .CFG file and compile it to a .DAT file. When a script is
compiled, there is only one difference. When an error occurs, the error
and line number are displayed, but not the actual line data and the screen is
blanked after the user presses a key.
Usage: COMPILE scriptfile
The errors you can recieve from the COMPILE program during the checking
are the same as the ones you recieve from the CHECK program.
──────────────
9.0 Demos
──────────────
Here is a list of the current demos that come with Installer!:
SOUND.CFG - Demonstrates how to read configuration from the user and store
it in a data file.
NUMBER.CFG - Number guessing game, shows how to use if ... then statements,
gotos and labels.
COPY.CFG - Fully-fledged, copying, install program. Shows how to parse
directories given by the user and how to display the status
on-screen. (uses pctbar.cfg)
──────────────
10.0 Keeping in touch
──────────────
If you find a bug anywhere in the program on in the documentation, please
report it immediately to one of the addresses below. Also, if you find a
problem with one of the examples or have one that's better, send it over.
Finally: if you have a suggestion, send it my way.
I can be contacted by any of these ways:
Snailmail (most stable, unless my house moves without me):
264 Sandpiper Circle NW
Calgary, Alberta, Canada
T3K 3T9
──────
Phone (also quite stable, but preferably bug reports and orders only):
(403) 275-0232
- 5pm to 9pm weekdays (local time for Calgary!)
- 9am to 9pm weekends " " " "
──────
Internet (not sure if it'll be up for much longer, but worth a try if it's
the most convenient):
rayban@cambo.cpubbs.cuug.ab.ca
──────
Fidonet (pretty stable):
1:134/40 @ Matthew Mastracci
──────
Metronet (a little more stable):
201:5500/905 @ Matthew Mastracci